// pages/edu/exam/jobs/index.js
import {ExamJobs} from '../../model/exam_jobs.js'
const ExamJobsModel=new ExamJobs()

Page({

  /**
   * 页面的初始数据
   */
  data: {
    id:0,
    info:{}
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    if(options.id){
      this.setData({
        id:options.id
      })
    }
    wx.setNavigationBarTitle({
      title: '职位考核-艾族大学'
    });

    this._getImages()
    this._getExamJobs()
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },

  //-------------------------------

  /**
   * edu images
   */
  _getImages(){
    ExamJobsModel.getAd('edu_images',(res)=>{
      this.setData({edu_images:res});
    });
  },

  /**
   * 获取职位详情
   */
  _getExamJobs(){
    ExamJobsModel.getInfo(this.data.id,(res)=>{
      this.setData({
        info:res
      })
    })
  },

  /**
   * 跳转到考试页面
   */
  onExamLink(event){
    let id=event.currentTarget.dataset.id
    wx.navigateTo({
      url: '../exam/index?id='+id
    })
  },

})